<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Layer Render</title>
    <script src='../lib/ol6.15.1/ol.js'></script>
    <link rel='stylesheet' href='../css/ol6.15.1/ol.css'>
    <link rel='stylesheet' href='../css/main.css'>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        html, body {
            width: 100%;
            height: 100%;
            overflow: hidden;
        }

        #map {
            width: 100%;
            height: 100%;
            background: rgba(255, 0, 255, 0.2);
        }

        .layer {
            background: rgba(0, 255, 0, 0.6);
        }
    </style>
</head>
<body>
<div id='map'></div>
<script>
    const divDom = document.createElement('div');
    divDom.style.width = document.body.clientWidth + 'px';
    divDom.style.height = document.body.clientHeight + 'px';
    divDom.className = 'layer';
    let layer = new ol.layer.Tile({
        render: () => {
            return divDom;
        }
    });

    /*layer = new ol.layer.Tile({
       source: new ol.source.OSM()
   });*/

    const circleFeature = new ol.Feature({
        geometry: new ol.geom.Circle([0, 0], 100)
    });
    circleFeature.setStyle(new ol.style.Style({
        stroke: new ol.style.Stroke({
            color: 'rgba(0,255,255,1)',
            width: 5
        }),
        fill: new ol.style.Fill({
            color: 'rgba(255,0,0,0.2)'
        })
    }));
    const circleSource = new ol.source.Vector({
        features: [circleFeature]
    });
    const circleLayer = new ol.layer.Vector({
        source: circleSource
    });

    const view = new ol.View({
        center: [0, 0],
        // extent: [0, 0, document.body.clientWidth, document.body.clientHeight],
        zoom: 1
    });
    const map = new ol.Map({
        layers: [circleLayer, layer],
        // layers: [layer, circleLayer],
        target: 'map',
        view
    });

    console.log(view.getProjection(),view.getProperties());

</script>
</body>
</html>